package com.sanhuo.idms.controller;

import com.sanhuo.idms.entity.RepairPersonal;
import com.sanhuo.idms.service.RepairPersonalService;
import com.sanhuo.idms.utils.SanhuoUtils;
import com.sanhuo.security.bo.PasswordUpdateBO;
import com.sanhuo.security.entity.User;
import com.sanhuo.security.service.UserService;
import com.sanhuo.security.service.UserTokenService;
import com.sanhuo.triild.page.Page;
import com.sanhuo.triild.page.PageSearch;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.Random;

@RequestMapping("user")
@RestController
public class UserController {
    @Autowired
    private UserTokenService userTokenService;
    @Autowired
    private UserService userService;


    @RequestMapping("detail")
    public User findById(String id) {
        return userService.findById(id);
    }

    @RequestMapping("info/update")
    public void updateInfo(User user) throws IllegalAccessException {
        userService.updateInfo(user);
    }

    @RequestMapping("password/update")
    public void updatePassword(PasswordUpdateBO bo) {
        userService.updatePassword(bo);
    }

    @RequestMapping("list")
    public Page<User> listAll(PageSearch pageSearch) {
        return userService.listAll(pageSearch);
    }


}
